package com.jiliang.jiliangserver.service.impl;

import com.jiliang.jiliangserver.domain.Battery;
import com.jiliang.jiliangserver.domain.Brand;
import com.jiliang.jiliangserver.domain.JlMessage;
import com.jiliang.jiliangserver.domain.MaterialLog;
import com.jiliang.jiliangserver.mapper.JiliangMapper;
import com.jiliang.jiliangserver.mapper.MaterialMapper;
import com.jiliang.jiliangserver.service.JiliangService;
import com.jiliang.jiliangserver.service.MaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 物资服务类
 */
@Service
public class JiliangServiceImpl implements JiliangService {

    @Autowired
    private JiliangMapper jiliangMapper;

    @Override
    public void createMessage(JlMessage message) {
        int message1 = jiliangMapper.createMessage(message);
        if (message1 <= 0) {
            throw new RuntimeException("创建失败");
        }
    }

    @Override
    public void updateMessage(JlMessage message) {
        int message1 = jiliangMapper.updateMessage(message);
        if (message1 <= 0) {
            throw new RuntimeException("更新失败");
        }
    }

    @Override
    public List<JlMessage> selectMessageList(JlMessage message) {
        List<JlMessage> jlMessages = jiliangMapper.selectMessageList(message);
        return jlMessages;
    }

    @Override
    public List<Map> getDictByType(String dictType) {
        List<Map> dictList = jiliangMapper.getDictByType(dictType);
        return dictList;
    }

    @Override
    public JlMessage selectMessageById(Long id) {
        JlMessage jlMessage = jiliangMapper.selectMessageById(id);
        return jlMessage;
    }
}
